<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
	<title>封条管理及验证系统--商品销售策略</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<LINK href="<%=request.getContextPath()%>/css/cssCn.css" type="text/css" rel="stylesheet">
<%@ include file="/comm.jsp"%>
<script>
function submitForm(opflag,actionUrl){
	if(opflag=='add'){
		if($d("selProductId").value == "-1"){
			alert("请选择商品");
			return;
		}
		if($d("selCompanyLevel").value=="-1"){
			alert("请选择企业级别");
			return;
		}
		if($d("discount").value==""){
			alert("请输入折扣");
			return;
		}
		if($d("dStartdate").value=="" || $d("dEnddate").value==""){
			alert("请输入正确的有效日期");
			return;
		}
	}
	document.formpage.action = actionUrl;
	document.formpage.submit();
}
</script>

<style type="text/css">
<!--
fieldset {
    padding:10px;
    margin:10px;
    width:270px;
    color:#333; 
} 
legend {
    color:#06c;
    font-weight:800; 
} 
	-->
</style>

	<body>
	<s:form name ="formpage" action="salesPlan_list" namespace="/">
		<s:hidden id="hdfId" name="plan.id" value="%{#request.plan.id}" />
		<div>
  		<%@ include file="/messages.jsp"%>
			<fieldset>
				<legend>
					新增销售策略
				</legend>
				<table align="center" width="700" border="0">
					<tr>
						<td align="right">
							商品名称：
						</td>
						<td>
							<s:select name="plan.productId" list="#request.productList"
							 id="selProductId"
							 headerKey="-1" headerValue="请选择"
							>
							</s:select>
						</td>
						<td align="right">
							企业级别：
						</td>
						<td>
							<!--
							<s:select name="plan.companyLevel" list="#request.levelList"
							 headerKey="-1" headerValue="请选择"
							>
							</s:select>
							-->
							<s:select list="#{'1':'普通会员','2':'认证会员','3':'银卡会员','4':'金卡会员','5':'白金会员','6':'钻石会员'}"	 
							 name="plan.companyLevel"
							 id="selCompanyLevel"
					  		 headerKey="-1" headerValue="请选择"
					  		 >
							</s:select>
						</td>
					</tr>
					<tr>
						<td align="right">
							折扣：
						</td>
						<td>
							<input id="discount" name="plan.discount" type="text" value="${plan.discount }"
							 maxlength="4" size="10" class="required"  title="*必填"
							/>
						</td>
						<td align="right">
							有效日期：
						</td>
						<td>
							<input id="dStartdate" name="plan.startDate" 
							 	value='<s:date name="#request.plan.startDate" format="yyyy-MM-dd" />'
							 	size="13" class="Wdate" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'dEnddate\')}'})"/> 
							至
							<input id="dEnddate" name="plan.endDate" 
							 	value='<s:date name="#request.plan.endDate" format="yyyy-MM-dd" />'
							 	size="13" class="Wdate" type="text" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'dStartdate\')}'})"/>
						</td>
					</tr>
					<tr>
						<td align="right">
							备注：
						</td>
						<td>
							<input name="plan.remark" type="text" value="${plan.remark }"
							 maxlength="20" size="20"	/>
						</td>
						<td></td>
						<td>
							<input type="button" class="button" id="btnAdd" name="btnAdd"
								value=" 新增 " onclick="return submitForm('add','salesPlan_save');"/>
							&nbsp;&nbsp;<input type="button" class="button" id="btnSearch" name="btnSearch" 
							value=" 查 询 " onclick="return submitForm('search','salesPlan_list');"/>
						</td>
					</tr>
				</table>
			</fieldset>
			
            <table border="0" cellpadding="5" cellspacing="1" class="tb_datalist">
			 <tr align="center" height="28px" class="tr_title">
				<td>
					<b>商品名称</b>
				</td>
				<td>
					<b>企业级别</b>
				</td>
				<td>
					<b>折扣</b>
				</td>
				<td>
					<b>有效期</b>
				</td>
				<td>
					<b>状态</b>
				</td>
				<td>
					<b>备注</b>
				</td>
				<td>
					<b>创建日期</b>
				</td>
				<td>
					<b>创建人</b>
				</td>
				<td>
					<b>操作</b>
				</td>
			</tr>
			
			<s:iterator id="sa" value="#request.list">
				<tr class="list_tr_item"
						onMouseOver="javascript:this.className='tr_selected';"
						onMouseOut="javascript:this.className='tr_even';">
					<td>
						<s:property value="getProductName(#sa.productId)" />
					</td>
					<td align="center">
						<s:property value="getLevelName(#sa.companyLevel)" />
					</td>
					<td align="center">
						<s:property value="#sa.discount" />
					</td>
					<td align="center">
						<s:date name="#sa.startDate" format="yyyy-MM-dd"/>	
						至
						<s:date name="#sa.endDate" format="yyyy-MM-dd"/>	
					</td>
					<td align="center">
						<s:if test="1==#sa.status">
							启用
						</s:if>
						<s:elseif test="2==#sa.status">
							已删除
						</s:elseif>
					</td>
					<td>
						<s:property value="#sa.remark" />
					</td>
					<td align="center">
						<s:date name="#sa.createDate" format="yyyy-MM-dd HH:mm"/>
					</td>
					<td>
						<s:property value="#sa.createUserid" />
					</td>
					<td align="center">
						<s:if test="1==#sa.status">
						<a href="<s:url action="salesPlan_delete"><s:param name="id"><s:property value="#sa.id"/></s:param></s:url>">
							删除
						</a>
						</s:if>
					</td>	
				</tr>
			</s:iterator>
		</table>
		<s:property value="#request.allowpage" escape="false" />
		</div>
		</s:form>
	</body>
</html>
